package cn.caplike.demo.repository.design.pattern.responsibilitychain;

import org.apache.commons.lang3.RandomUtils;

public class Client {

    public static void main(String[] args) {
        final Handler handler = new ConcreteHandlerA(new ConcreteHandlerB(new ConcreteHandlerC()));
        final boolean handled = handler.handle("我要请假!", RandomUtils.nextInt(1, 99));
        if (!handled) {
            System.err.println("没人能处理这次请假!");
        }

        // 没人能处理这次请假!

        // 处理请求：我要请假!
        // 请假天数：25
        // ConcreteHandlerC handled

        // 处理请求：我要请假!
        // 请假天数：2
        // ConcreteHandlerA handled
    }
}
